/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.route.system.bean;

import com.route.system.entity.RpsRouteDescription;
import com.route.system.session.RpsRouteDescriptionFacade;
import java.io.Serializable;
import java.util.List;
import java.util.Locale;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author neco
 */
@ManagedBean(name="RouteBean")
@ViewScoped
public class RouteBean implements Serializable{
    private RpsRouteDescription routeDescription = new RpsRouteDescription();
    @EJB
    private RpsRouteDescriptionFacade routeDescriptionFacade;
   

    public RouteBean() {
    }
    public String search() {
        if((routeDescription == null) && (routeDescription.getDescriptionId()== null)) {
            return null;
        }
        return "vehicleSchedule.xhtml?faces-redirect=true&descriptionId="+routeDescription.getDescriptionId();
    }
    public List<RpsRouteDescription> completeVehicle(String value) {
        return routeDescriptionFacade.complete("%" + value.toUpperCase(new Locale("tr", "TR")) + "%");
    }

    public RpsRouteDescription getRouteDescription() {
        return routeDescription;
    }

    public void setRouteDescription(RpsRouteDescription routeDescription) {
        this.routeDescription = routeDescription;
    }
    
    
}
